package com.itheima.service.impl;

import com.itheima.mapper.BankMapper;
import com.itheima.pojo.Bank;
import com.itheima.service.BankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class BankServiceImpl implements BankService {

    @Autowired
    private BankMapper bankMapper;
    /**
     * 根据城市id查询所有银行网点
     * @param areaid 城市id，-1表示没有选择城市
     * @return
     */
    public List<Bank> findAll(int areaid) {
        List<Bank> bankList = bankMapper.findAll(areaid);
        return bankList;
    }

    /**
     * 新增银行网点信息
     * @param bank
     */
    public void add(Bank bank) {
        bankMapper.add(bank);
    }

    /**
     * 根据id查询网点信息bank
     * @param id
     * @return
     */
    public Bank findById(int id) {
        Bank bank = bankMapper.findById(id);
        return bank;
    }
    /**
     * 修改银行网点信息
     * @param bank
     */
    public void update(Bank bank) {
        bankMapper.update(bank);
    }

    /**
     * 根据id删除银行网点信息
     * @param id
     */
    public void deleteById(int id) {
        bankMapper.deleteById(id);
    }
}
